/*
  This file is part of 'Trivial chess'.

  'Trivial chess' is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  'Trivial chess' is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with 'Trivial chess'.  If not, see <http://www.gnu.org/licenses/>.
*/

/* SVN FILE: $Id$ */
/**
 * @author         $Author$
 * @version        $Rev$
 * @lastrevision   $Date$
 * @filesource     $URL$
 */

#ifndef BOARDCOMMON_H_
#define BOARDCOMMON_H_

template<class C, class CA, class S, class Int>
class BoardCommon {
public:
	C sideToMove() const { return this->_sideToMove; }
	void setSideToMove(const C sideToMove) {
		this->_sideToMove = sideToMove;
	}
	void setRivalToMove() { this->_sideToMove.setRival(); }

	S enpassant() const { return this->_enpassant; }
	void setEnpassant(const S enpassant) {
		this->_enpassant = enpassant;
	}

	CA castlingAvailability() const { return this->_castlingAvailability; }
	void setCastlingAvailability(const CA castlingAvailability) {
		this->_castlingAvailability = castlingAvailability;
	}

	Int halfmoveClock() const { return this->_halfmoveClock; }
	void setHalfmoveClock(const Int halfmoveClock) {
		this->_halfmoveClock = halfmoveClock;
	}
	void resetHalfmoveClock() {
		this->_halfmoveClock = 0;
	}
	void incHalfmoveClock() {
		++_halfmoveClock;
	}

	Int fullmoveNumber() const { return this->_fullmoveNumber; }
	void setFullmoveNumber(const Int fullmoveNumber) {
		this->_fullmoveNumber = fullmoveNumber;
	}
	void incFullmoveNumber() {
		++_fullmoveNumber;
	}
	void decFullmoveNumber() {
		--_fullmoveNumber;
	}

private:
	C _sideToMove;
	CA _castlingAvailability;
	S _enpassant;
	Int _halfmoveClock;
	Int _fullmoveNumber;
};

#endif /* BOARDCOMMON_H_ */
